import './assets/js/flexible.js';
import './assets/css/reset.css';
import './assets/css/font-awesome.min.css';
import Vue from 'vue';
import App from './App';
import router from './router';
import resource from 'vue-resource';
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css';
import Vuex from 'vuex';
import VueLazyload from "vue-lazyload";

Vue.use(Mint);
Vue.use(resource);
Vue.use(Vuex);

Vue.use(VueLazyload,{
	loading:'../static/favicon.png',
	try:3
})

Vue.filter('aaa',function(value){
	if(!value) {return ''}
	value = value.toString()
	return "￥" + value + '.00'
})


const store = new Vuex.Store({
		state :{
			data:{
				data:[],
				img:"",
			},
			shop:[]
		},
		mutations:{ //行为，对状态进行改变，静态行为
			addState(state,obj){
				
				obj.data=state.data.data
				var arr=state.shop
				if(arr.length==0){
					arr.push(obj)
				}else{
					for(var i=0;i<arr.length;i++){
						if(arr[i].order.id==obj.order.id){
							arr[i]=obj
							var tag=true
						}
					}
					if(!tag){
						arr.push(obj)
					}
				}
				console.log(arr)
			}
		}
	})

		new Vue({
		el: '#app',
		router,
		resource,
		store,
		template: '<App/>',
		components: { App }
		})

